<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/base/taglibs.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
  <head>
    <title>${systemOption.systemTitle}</title>
    <%@ include file="/base/head.jsp"%>
    <script type="text/javascript" charset="UTF-8">
  //分页查询
  function doQuery(){

  	var queryParams=$('#user').datagrid('options').queryParams;
  	queryParams.userName=$('#userNameSch').val();
  	queryParams.name=$('#nameSch').val();
  	queryParams.status=$('#statusSch').combobox('getValue');
  	queryParams.deptId=${sessionScope.deptId};
  	queryParams.stationId=$('#stationIdSch').combobox('getValue');
  	//重置当前页数为1
  	resetDG('#user');

  } 
 	function backMap(){
		history.go(-1);
	} 
	//根据不同值，显示不同内容
	function formatStatus(val,row){
		if (val == 1){
			return '正常';
		}else if (val == 2){
			return '<span style="color:red;">停用</span>';
		} else {
			return '无';
		}
	}


 	//详情
		function detail(){
	 	var row = $('#user').datagrid('getSelected');
	 	$('#xqdlg').show();	
	 	$('#xqdlg').dialog({
	 		title: '详情',   
		    width: 550,
		    height:430,
		    top:50,
		    closed : false,
			cache : false,
			maximizable : true,
			collapsible : false,
			minimizable : false,
		    href: '${ctx}/json/userDetail.action?id='+row.id,
		    cache: false, 
		    modal: true,
		    buttons:[{
		    	text:'关闭',
				iconCls:'icon-cancel',
				handler:function(){
					$('#xqdlg').dialog('close');
				}	    	
		    }]
	 	});	
	 } 
    </script>
  </head>
  
  <body>
    <!-- 主窗口 -->  	 
    <table id="user" class="easyui-datagrid" data-options="fit:true,
    								rownumbers:true,
									singleSelect:true,
									striped:true,
									fitColumns:true,
									toolbar:'#tb',
									pagination:true,
									pageSize:20,
									pageList:[20,30,50,100],
									onDblClickRow:detail,
									url:'${ctx}/json/listUserForDept.action',">
		<thead>
			<tr>
				<th data-options="field:'ck',checkbox:true"></th>
				<th data-options="field:'name',align:'left',halign:'center'" width="150"><strong>姓名</strong></th>
				<th data-options="field:'userName',align:'center'" width="80"><strong>用户名</strong></th>
				<th data-options="field:'status',align:'center',formatter:formatStatus" width="50" ><strong>状态</strong></th>
				<th data-options="field:'deptName',align:'left',halign:'center'" width="150"><strong>部门</strong></th>
				<th data-options="field:'stationName',align:'left',halign:'center'" width="80"><strong>岗位</strong></th>
				<th data-options="field:'id',hidden:true"></th>
				<th data-options="field:'stationCode',hidden:true"></th>
			</tr>
		</thead>
		
	</table>
<!-- Datagrid工具栏 -->
<div id="tb">
	<table width="100%" cellpadding="0" cellspacing="0">
	<tr>
	   <td class="toolDiv">  	
	   <a href="javascript:void(0)" onclick="backMap()" class="easyui-linkbutton" data-options="iconCls:'icon-back',plain:true">返回首页</a><span class="vline">|</span>	
		</td>
	</tr>
	<tr>
	   <td class="serchDiv">
	   		<table width="100%" cellpadding="0" cellspacing="0">
	   			<tr>
	   				<td>用户名</td>
	   				<td><input id="userNameSch" class="easyui-textbox" type="text" style="width: 120px;"></td>
	   				<td>状态</td>
	   				<td>
						<select id="statusSch" class="easyui-combobox" style="width:125px;">
							<option value="0">--全部--</option>
							<option value="1">正常</option>
							<option value="2">停用</option>
						</select>
	   				</td>
	   			</tr>
	   			<tr>
	   				<td>姓名</td>
	   				<td><input id="nameSch" class="easyui-textbox" type="text" style="width: 120px;"></td>
	   				<td>岗位</td>
	   				<td><input id="stationIdSch" class="easyui-combobox" data-options="
                        	                                                                url:'${ctx}/json/listStationTreeP.action',
                        	                                                                value:'0',
                        	                                                                valueField:'id',
                        	                                                                textField:'stationName',
                        	                                                                panelHeight:'200'" 
                        	                                                                style="width:155px" />
                    </td>
                    <td>
                    	<a href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-search',plain:true" 
								onclick="doQuery()">查询</a>
                    </td>
	   			</tr>
	   		</table>
		</td>
	</tr>
	</table>
</div>  	 

    <!-- 详情窗口 -->    
	<div id="xqdlg" style="display: none">
   	</div>
  </body>
</html>
